<%@ page contentType="text/html;charset=UTF-8" language="java"
         pageEncoding="utf-8"
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <!--写base标签，永远固定相对路径跳转的结果-->
    <%--    <base href="http://localhost:8080/book/">--%>

    <%--<link type="text/css" rel="stylesheet" href="static/css/common.css" >--%>
        <%@include file="/pages/common/head.jsp"%><%--静态引用,包括项目起始点,和css,jquery等头部信息 --%>
    <link rel="stylesheet" href=<%=basepath+"static/css/login.css"%>>
</head>
<body>
<div class="container" style="width: 1000px;position: relative;top:40px">
    <form action=<%=basepath+"userServlet"%> role="form" class="form-horizontal" method="post">
        <h1 class="text-center">CMDB</h1>
        <div class="col-md-4 col-md-offset-4" style="height: 30px;color: sandybrown">
            <span class="text-center glyphicon glyphicon-alert" id="msg">
            ${empty sessionScope.msgLogin?"请输入用户名":sessionScope.msgLogin} <%--用el表达式替换jsp表达式,短一点--%>
            </span>
            <a href="<%=basepath+"pages/user/regist.jsp"%>" class="btn col-md-offset-5" target="_blank" >注册</a>
        </div>
        <input type="hidden" name="action" value="login">
        <div class="form-group">
            <div class="col-md-4 col-md-offset-4">
                <input type="text" class="form-control input-gl loginInput" placeholder="username" id="name" autofocus name="username"
                <%--value="<%=request.getAttribute("username")==null?"":request.getAttribute("username")%>"--%>
                       value="${sessionScope.username}" <%--el表达式默认返回就是空字符串,所以,不需要判断是否有值,然后负空.它自己就会把null写成空--%>
                >
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-4 col-md-offset-4">
                <input type="password" class="form-control input-gl loginInput" placeholder="password" id="password" name="password"
                <%--value="<%=request.getAttribute("password")==null?"":request.getAttribute("password")%>"--%>
                       value="${sessionScope.password}" <%--el表达式默认返回就是空字符串,所以,不需要判断是否有值,然后负空.它自己就会把null写成空--%>
                >
            </div>
        </div>
        <div class="form-group ">
            <div class="col-md-2 col-md-offset-4 ">
                <input type="text" class="form-control loginInput"  placeholder="code" id="code" name="code"
                <%--value="<%=request.getAttribute("code")==null?"":request.getAttribute("code")%>"--%>
                       value="${sessionScope.code}" <%--el表达式默认返回就是空字符串,所以,不需要判断是否有值,然后负空.它自己就会把null写成空--%>
                >
            </div>
            <div class="col-md-2 col-lg-2 codeImg loginInput">
                <img src="<%=basepath%>kaptcha.jpg" alt="code" id="code_img">
            </div>
            <script>
                $("#code_img").click(function (event){
                    this.src="<%=basepath%>kaptcha.jpg"//http://localhost:80/kaptcha.jpg
                })
            </script>
        </div>
        <div class="form-group">
            <div class="col-md-4 col-md-offset-4">
                <button class="btn btn-lg btn-primary btn-block col-md-4">提交</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>